// run: $exec < input
#include <iostream>

long long n;

long long get_r(long long m)
{
	return 3 * m * m - 3 * m + 1;
}

int main()
{
	std::cin >> n;
	long long l = 1, r = 577355;
	while (l + 1 < r) {
		long long mid = (l + r) / 2;
		if (get_r(mid) >= n * n) r = mid;
		else l = mid;
	}
	if (get_r(r) > n * n) r = l;
	long long ans = (1 + 6 * (r - 1)) * r / 2;
	std::cout << ans << '\n';
}

